all: codegen assembly codelink linker

codegen:
	$(CXX) -Wall -g -o $@ codegen.cpp
	./codegen > calc_expr.s

assembly: 
	as -c -o calc_expr.o calc_expr.s

codelink:
	$(CXX) -c -o codelink.o codelink.cpp

linker:
	$(CXX) -o calc codelink.o calc_expr.o
	./calc

clean: 
	rm -f codegen
	rm -f calc
	rm -f codelink.o
	rm -f calc_expr.o
	rm -f calc_expr.s
